import Vue from 'vue'
import Router from 'vue-router'
import Login from "@/views/Login";
import Home from "@/views/Home";
import FriendChat from "@/views/chat/FriendChat";
import AdminInfo from "@/views/AdminInfo";



Vue.use(Router)

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      component:Login,
      hidden:true
    },
    {
      path: '/home',
      component: Home,
      children:[
        {
          path:'/chat',
          name:'在线聊天',
          component:FriendChat
        },
        {
          path:'/userinfo',
          name:'个人中心',
          component:AdminInfo
        }
      ]
    }
    // {
    //   path: '/home',
    //   name:'选项一',
    //   component: Home,
    //   children:[
    //     {
    //       path: '/test1',
    //       name:'导航一',
    //       component: Test1
    //     }
    //   ]
    // },

  ]
})
